<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/jstl.jsp" %>
 
<script language="javascript">
  	$(document).ready(function(){
		   	//转化日期格式
			  turnDateFormat(); 	
    }); 
  	 //加载完页面就执行此方法 查找对应的支付方式(ajax 调后台不打日志)
  //	  $(document).ready(function(){
  //	  	
  //	  	 
  //	  	var obj = document.getElementById("opeTypeId").value;
  //	  	
  //	  	  //alert("所传的业务类型代码为 ="+ obj );
  //	  	 
  //	  	 
	//				   	var result=$.ajax({
	//				   		type:"GET",
	//						  url:"540248.tran?LIMIT_BUS_CODE="+obj,
	//						  dataType:"json",
	//						  async:false,   //是否异步
	//				      timeout:1000,
	//				        success:function(data){
	//				         
	//				       
	//				         if(data['RSPCOD']=='000000'){
	//				         	     var ob = document.getElementById("LIMIT_BUS_CLIENT").value;
  //       	 							 //alert("支付方式为 ："+ ob );
	//								       var str="<option value='0'>忽略支付方式</option>";
	//								       
	//								       $(data['REC2']).each(function(){
	//								        
	//								       		str+= '<option value="' + this.DICT_CODE + '"  ' ;
	//								       		
	//								       		if(	ob == this.DICT_CODE){
	//								       			str +=  'selected="selected"';
	//								       		
	//								       			}
	//								       		
	//								       		str += '  >' + this.DICT_CODE + '-' + this.DICT_NAME + '</option>';
	//								       		
	//									     		  });
	//									     		  
	//									     	//alert ("打印 str = "+str);
	//								
	//								       	$("#PARENT_CODE").html(str);
	//								      }
	//								    
	//				        }
	//				   		});
	//			 
	//				   		
  //    }); 	
    function check(){
    	    var isCheck =document.getElementById("notall_0").checked;
    	    if(isCheck) {
				    	//时间
				    	var mydatea = document.getElementById("mydatea").value;
				    	var mydateb = document.getElementById("mydateb").value;				    	
				    	mydatea = mydatea.replace("-" ,"").replace("-" ,"");
				    	mydateb = mydateb.replace("-" ,"").replace("-" ,"")
				    	//alert(mydatea+"- VS - "+mydateb);
				    	if(mydatea > mydateb){
				    		alertMsg.info("开始时间不能小于结束时间！");  		
				    		document.getElementById("mydateb").focus();
				    		return false;
				    	}   	
		      }
		    	//金额
		    	var amt1 = document.getElementById("LIMIT_MIN_AMT").value;
		    	var amt2 = document.getElementById("LIMIT_MAX_AMT").value;		    	
		    	//alert(amt1+" -VS- "+amt2);
		    	
		    	if(amt1!="" && amt2!="") {
				    	if(parseFloat(amt1) > parseFloat(amt2)){
				    		alertMsg.info("单笔最小金额不能大于单笔最大金额！");
				    		document.getElementById("LIMIT_MAX_AMT").focus();
				    		return false;
				      }
		      }
		    	
		    	//每日交易次数 * 单笔最大限额 <= 每日交易限额
		    	var cou3 = document.getElementById("LIMIT_DAY_TIMES").value;
		    	var amt3 = document.getElementById("LIMIT_DAY_AMT").value;
		    	//alert(cou3 +"- VS - "+amt3);
		    	if(cou3!="" && amt3!="") {
			    	if(parseFloat(amt2)*parseFloat(cou3) > parseFloat(amt3)){
				    	alertMsg.info("每日交易次数*单笔最大限额不能大于每日交易限额！"); 
			    		document.getElementById("LIMIT_DAY_AMT").focus();
			    		return false;
			    	}
		      }
		    	//每月交易次数 * 单笔最大限额 <= 每月交易限额
		    	var cou4 = document.getElementById("LIMIT_MONTH_TIMES").value;
		    	var amt4 = document.getElementById("LIMIT_MONTH_AMT").value;
		    	//alert(cou4 +"- VS - "+amt4);
		    	if(cou4!="" && amt4!="") {
				    	if(parseFloat(amt2)*parseFloat(cou4) > parseFloat(amt4)){
				    	  alertMsg.info("每月交易次数*单笔最大限额不能大于每月交易限额！"); 
				    		document.getElementById("LIMIT_MONTH_AMT").focus();
				    		return false;
				    	}
		      }
		    	if(cou3!="" && cou4!="") {
				    	if(parseFloat(cou4) < parseFloat(cou3)){
				    	  alertMsg.info("每月交易次数不能小于每日交易次数！"); 
				    		document.getElementById("LIMIT_MONTH_TIMES").focus();
				    		return false;
				    	}
		      }
		    	if(amt3!="") {
				    	if(parseFloat(amt3) < parseFloat(amt2)){
				    	  alertMsg.info("每日交易金额不能小于单笔最大金额！"); 
				    		document.getElementById("LIMIT_DAY_AMT").focus();
				    		return false;
				    	}
		      }
		    	if(amt4!="") {
				    	if(parseFloat(amt4) < parseFloat(amt2)){
				    	  alertMsg.info("每月交易金额不能小于单笔最大金额！"); 
				    		document.getElementById("LIMIT_MONTH_AMT").focus();
				    		return false;
				    	}
		      }
		    	if(amt3!="" && amt4!="") {
				    	if(parseFloat(amt4) < parseFloat(amt3)){
				    	  alertMsg.info("每月交易金额不能小于每日交易金额！"); 
				    		document.getElementById("LIMIT_MONTH_AMT").focus();
				    		return false;
				    	}
		      }
		    	return true;    	 
    } 	
 	
    //联动效果：改变业务类型时支付方式联动改变
	 	function change(objs){
	  	
	  		//alert("=="+objs);	
			  	
			   	var result=$.ajax({
			   		type:"GET",
					  url:"540245.tran?PARENT_CODE="+objs,
					  dataType:"json",
					  async:false,   //是否异步
			      timeout:1000,
			      success:function(data){		        	
			        var str="<option value='0'>忽略支付方式</option>";
			         if(data['RSPCOD']=='000000'){
						       $(data['REC']).each(function(){					        
						           str+='<option value="'+this.DICT_CODE+'">'+ this.DICT_CODE+'-'+this.DICT_NAME+'</option>';
							     });					
						       $("#LIMIT_BUS_CLIENT").html(str);
					     }else{
					      	  //alert(data['RSPMSGD']);
					      		$("#LIMIT_BUS_CLIENT").html(str);
					      	  }
					     }		   		
			   		});  
	  } 	      
    function checkNums(obj){
		   obj.value = obj.value.replace(/[^\d.]/g,"");
		   obj.value = obj.value.replace(/^\./g,"");
		   obj.value = obj.value.replace(/\.{2,}/g,".");
		   obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
		}
		
    function chooseDate(){
				//alert("显示2"+document.getElementById("mydatea").style.display);
			  document.getElementById("mydatea1").style.display="block";
				document.getElementById("mydateb1").style.display="block";
				document.getElementById("indate1").style.display="block";
				document.getElementById("mydatea1").className='required textInput';
				document.getElementById("mydateb1").className='required textInput';
		}
		
		function chooseDate1(){				
				document.getElementById("mydatea1").style.display="none";
				document.getElementById("mydateb1").style.display="none";
				document.getElementById("indate1").style.display="none";
			  document.getElementById("mydatea1").className="";
			  document.getElementById("mydateb1").className="";		
		}
		function chooseDate22(){
				//alert("显示2"+document.getElementById("mydatea").style.display);
			  document.getElementById("mydatea").style.display="block";
				document.getElementById("mydateb").style.display="block";
				document.getElementById("indate").style.display="block";
				document.getElementById("mydatea").className='required textInput';
				document.getElementById("mydateb").className='required textInput';
		}
		
		function chooseDate2(){				
				document.getElementById("mydatea").style.display="none";
				document.getElementById("mydateb").style.display="none";
				document.getElementById("indate").style.display="none";
			  document.getElementById("mydatea").className="";
			  document.getElementById("mydateb").className="";		
		}

		function chooseType(obj){
				//alert(obj);
				if(obj=='3'){
					document.getElementById('aaa').value=document.getElementById('aa').value;
					document.getElementById('aaa').readOnly=false;
					
				}else {
					document.getElementById('aaa').value='';
					document.getElementById('aaa').readOnly=true;
				
				}
			
		}
</script>  
<h2 class="contentTitle" style="background-color:#E8F1FD;">修改用户限额</h2>
<div class="pageContent"  style="background-color:#E8F1FD;" >	
<form  method="post" action="540249.tran" onsubmit="return validateCallback(this, navTabAjaxDone)" class="pageForm required-validate">
	<input type="hidden" name="ID" id="ID"  value="${ETF.ID}">
	<div  class="pageFormContent" layoutH="87"  > 
		 
		 <!--用户状态类型是否显示，1:显示 0;不显示 -->
		 <c:if test="${ETF.IS_SHOW_LIMIT_USER_TYPE != '0'}">
		 		<table  border="0" width="900px">
					 <tr height="30px">
						 	 <td width="17%">用户状态类型：</td>
						 	 <td>
						 	 	<table>
						 	 		<tr>
						 	 			<td> <input id="all" type="radio"  name= "LIMIT_USER_TYPE"  value="1" <c:if test="${ETF.LIMIT_USER_TYPE =='1'}">checked </c:if> onclick="chooseType(this.value);" checked />实名</td>
						 	 		 
						 	 			<td> <input id="all" type="radio"  name= "LIMIT_USER_TYPE"  value="2" <c:if test="${ETF.LIMIT_USER_TYPE =='2'}">checked </c:if>  onclick="chooseType(this.value);" />非实名</td>
						 	 		 
						 	 			<td > <input id="notall" type="radio" name ="LIMIT_USER_TYPE"  value="3" <c:if test="${ETF.LIMIT_USER_TYPE =='3'}">checked </c:if>  onclick="chooseType(this.value);" />指定证件 </td>
						 	 			
						 	 			<td> <input type="text"  id="aaa"    name="LIMIT_PAPER_CODE" value='${ETF.LIMIT_PAPER_CODE}' size="18" maxlength="18"   onkeyup="checkNums(this)" disabled  /> </td>
						 	 		</tr>	
						 	 	</table>
						 	</td>
					</tr>
			</table>
	 </c:if>

	
	<!--用户业务类型及支付方式是否显示，1:显示 0;不显示 -->
	<c:if test="${ETF.IS_SHOW_LIMIT_BUS_CODE != '0'}">
		 <table  border="0" width="900px">
		 	<tr height="30px">
				<td width="17%">请选择业务类型：</td>
				<td>
					<input type="text" id="LIMIT_BUS_CODE" name="LIMIT_BUS_CODE" value="${ETF.LIMIT_BUS_CODE_}" size="20"    readonly  />
					<!--
					 <select  name="DICT_CODE" id="opeTypeId" onchange="change(this.value);">
              <c:choose>
                     <c:when test="${ETF.RSPCOD=='000000'}">
                        <c:forEach items="${ETF.REC1}" var="GRP">	
                        	 <option value="${GRP.DICT_CODE}"    <c:if test="${ETF.LIMIT_BUS_CODE==GRP.DICT_CODE}"> selected="selected" </c:if> >${GRP.DICT_CODE}-${GRP.DICT_NAME}</option> 
                        	 </c:forEach>
                        
                     </c:when>
            	       <c:otherwise>
            				    <tr>
            					    <td>表中无相关记录2</td>
            				    </tr>
            			   </c:otherwise>
		          </c:choose>      	  
         </select> -->
					<span style="color:red">*</span>
				</td>
		 </tr>
		 
		 <tr height="30px">
				<td width="17%">请选择支付方式：</td>
				<td>
					<!-- -->
					  <input type="text" id="LIMIT_BUS_CLIENT" name="LIMIT_BUS_CLIENT"  <c:if test="${ETF.LIMIT_BUS_CLIENT_== null}"> value='--忽略--' </c:if>  value="${ETF.LIMIT_BUS_CLIENT_}" size="20"    readonly  />
				 
				</td>
	   </tr>
		</table>
	</c:if>
	
<c:if test="${ETF.IS_SHOW_LIMIT_BUS_CODE == '0'}">
	 <input   id="opeTypeId"  type="hidden"  /> 
	 <input   id="LIMIT_BUS_CLIENT"  type="hidden"  /> 
</c:if>
		
		
			<table  border="0" width="900px" >
				
				<!--
				  <tr height="30px">
						  <td>运营商全称 ：</td>
						  <td colspan="3">
								<input type="text" id="COMP_NAME"  name="COMP_NAME"    value='${ETF.COMP_NAME}'   size="30 maxLength="20" readonly /> 
							</td>
				  </tr>
				  -->
					<tr height="35px">
						  <td>限额生效时间范围 ：</td>
						  <td colspan="3">
									<c:if test = "${ETF.LIMIT_START_DATE == '19700101' }">
									 <table>
									 	<tr>
									    <td><input id="all_0" type="radio"  name = "LIMIT_START_TYPE"  onclick="chooseDate1();" value="0" checked /> 永久</td>
				              <td>&nbsp;&nbsp;&nbsp;</td>
				              <td><input id="notall_0" type="radio" name ="LIMIT_START_TYPE"  onclick="chooseDate();" value="1" />按交易时间 </td>
				              <td>&nbsp;&nbsp;&nbsp;</td>
				              <td><input   id="mydatea1"  name="LIMIT_START_DATE"  style="display:none" type="text"  class="date"  yearstart="-80" yearend="5" format="yyyy-MM-dd" readonly="true"  size="10"/></td>
				              <td><span   id="indate1" class="info" style="display:none">~~</span></td>
						          <td><input   id="mydateb1" name="LIMIT_END_DATE" style="display:none" type="text"   class="date"  yearstart="-80" yearend="5" format="yyyy-MM-dd" readonly="true"  size="10" /></td>
						           </tr>
				   				 </table>
									</c:if>									
									 <c:if test = "${ETF.LIMIT_START_DATE != '19700101' }">
									 <table>
									 	<tr>
									 <td><input id="all_0" type="radio"  name = "LIMIT_START_TYPE"  onclick="chooseDate2();" value="0"  /> 永久</td>   
									 <td>&nbsp;&nbsp;&nbsp;</td>
				           <td><input id="notall_0" type="radio" name ="LIMIT_START_TYPE"  onclick="chooseDate22();" value="1" checked/>按交易时间<td>
				           <td>&nbsp;&nbsp;&nbsp;</td>
				           <td><input  id="mydatea" name="LIMIT_START_DATE"  value="${ETF.LIMIT_START_DATE}"  type="text"  class="formatDate required date"  yearstart="-80" format="yyyy-MM-dd"  yearend="5" readonly="true"  size="10"/>
				               <span   id="indate" class="info" >~~</span>
						           <input  id="mydateb" name="LIMIT_END_DATE"    value="${ETF.LIMIT_END_DATE}"  type="text"  class="formatDate required date" yearstart="-80" format="yyyy-MM-dd"  yearend="5" readonly="true"  size="10" /></td>
						     </tr>
				   				 </table>
									</c:if>
							</td>
				 </tr>
				 
					<tr height="35px">
						 
						  <td>单笔最大金额：
							</td>
						  <td>
								<input type="text" id="LIMIT_MAX_AMT" name="LIMIT_MAX_AMT"  
								value="<c:if test="${ETF.LIMIT_MAX_AMT!=null}"><fmt:formatNumber type='currency' value='${ETF.LIMIT_MAX_AMT/100}' pattern='0.00'/></c:if>" 
								 size="30"  max="99999999999.99"  min="0" maxLength="14" class="required number"/>		
							</td>
							
							 <td>单笔最小金额：
							</td>
						  <td>
								<input type="text" id="LIMIT_MIN_AMT" name="LIMIT_MIN_AMT" 
								value="<c:if test="${ETF.LIMIT_MIN_AMT!=null}"><fmt:formatNumber type='currency' value='${ETF.LIMIT_MIN_AMT/100}' pattern='0.00'/></c:if>" 
								 size="30"  max="99999999999.99"  min="0" maxLength="14" class="required number"/>
							</td>
				 </tr>
			 
				 	<tr height="30px">
				 		 <td>每日交易次数：
							</td>
						  <td>
								<input type="text" id="LIMIT_DAY_TIMES"  name="LIMIT_DAY_TIMES"  value="${ETF.LIMIT_DAY_TIMES}"  size="30" maxLength="10" min="1" class="digits" />	
							</td>
							
						<td>每日交易限额：
							</td>
						  <td>
								<input type="text" id="LIMIT_DAY_AMT"  name="LIMIT_DAY_AMT"  value='${ETF.LIMIT_DAY_AMT/100}'size="30" max="99999999999.99"  min="0" maxLength="14"  class="number" /> 
								 	<span class="info">（单位：元）</span>
							</td>
							 
						 
						   
				 </tr>
				  
					<tr height="35px">
						  <td>每月交易次数：
							</td>
						  <td>
								<input type="text" id="LIMIT_MONTH_TIMES" name="LIMIT_MONTH_TIMES" value="${ETF.LIMIT_MONTH_TIMES}" size="30" min="1" maxLength="10"  class="digits"/>	
							</td>
						  <td>每月交易限额：
							</td>
						  <td>				
								<input type="text" id="LIMIT_MONTH_AMT"  name="LIMIT_MONTH_AMT" 
								value="<c:if test="${ETF.LIMIT_MONTH_AMT!=null}"><fmt:formatNumber type='currency' value='${ETF.LIMIT_MONTH_AMT/100}' pattern='0.00'/></c:if>" 
								size="30" maxLength="14"  max="99999999999.99"  min="0" class="number" />
							</td>
				 </tr>
				 
				<!--
				 <tr height="30px">
						  <td>不允许金额格式：
							</td>
						  <td colspan="3"> 
			          <input type="text" name="AMT_PATTERN_LIMIT"    size="30" value="${ETF.AMT_PATTERN_LIMIT}"  maxLength="3" class="required number" class="digits"/> 	<span class="info">（整数重复位数）</span>
							</td>
				 </tr>
				 <tr height="30px">
						  <td>单用户单日最多用卡数：
							</td>
						  <td>
								<input type="text" id="MAX_CARD_NUM" name="MAX_CARD_NUM"  size="30" value="${ETF.MAX_CARD_NUM}" max="999"  min="0" maxLength="3" class="required number"/>
								<span class="info">（单位：个）</span>
							</td> 
				 </tr>
				 <tr height="30px">
						<td>信用卡交易时间间隔不小于：
							</td>
						  <td>
								<input type="text" id="XY_CARD_TXN_INTERVAL" name="XY_CARD_TXN_INTERVAL"  value="${ETF.XY_CARD_TXN_INTERVAL}" size="30"  max="99999999"  min="0" maxLength="8"  class="required number"/>
								<span class="info">（单位：秒）</span>
							</td>
				 
						  <td>借记卡交易时间间隔不小于：
							</td>
						  <td>
								<input type="text" id="JJ_CARD_TXN_INTERVAL" name="JJ_CARD_TXN_INTERVAL"  value="${ETF.JJ_CARD_TXN_INTERVAL}" size="30"   max="99999999"  min="0" maxLength="8"  class="required number"/>
							  <span class="info">（单位：秒）</span>
							</td> 
				 </tr>
				  <tr height="30px">
						<td>信用卡单笔最大金额：
							</td>
						  <td>
								<input type="text" id="XY_CARD_ONCE_AMT" name="XY_CARD_ONCE_AMT"  value="${ETF.XY_CARD_ONCE_AMT/100}" size="30"  max="99999999999.99"  min="0" maxLength="14" class="required number"/>
								<span class="info">（单位：元）</span>
							</td>
				 
						  <td>借记卡单笔最大金额：
							</td>
						  <td>
								<input type="text" id="JJ_CARD_ONCE_AMT" name="JJ_CARD_ONCE_AMT"  value="${ETF.JJ_CARD_ONCE_AMT/100}" size="30"  max="99999999999.99"  min="0" maxLength="14" class="required number"/>
							  <span class="info">（单位：元）</span>
							</td> 
				 </tr>
				  <tr height="30px">
						<td>信用卡日累计最高金额：
							</td>
						  <td>
								<input type="text" id="XY_CARD_DAY_AMT" name="XY_CARD_DAY_AMT"  value="${ETF.XY_CARD_DAY_AMT/100}"   size="30"  max="99999999999.99"  min="0" maxLength="14" class="required number"/>
								<span class="info">（单位：元）</span>
							</td>
				 
						  <td>借记卡日累计最高金额：
							</td>
						  <td>
								<input type="text" id="JJ_CARD_DAY_AMT" name="JJ_CARD_DAY_AMT"  value="${ETF.JJ_CARD_DAY_AMT/100}"  size="30"  max="99999999999.99"  min="0" maxLength="14" class="required number"/>
							  <span class="info">（单位：元）</span>
							</td> 
				 </tr> -->
					<tr height="35px">
						  <td>启用标志：
							</td>
						  <td colspan="3">
			          <input type="radio" name="IS_USE" value="1" <c:if test="${ETF.IS_USE eq '1'}"> checked="checked"</c:if>>启用</input>
			          <input type="radio" name="IS_USE" value="0" <c:if test="${ETF.IS_USE eq '0'}"> checked="checked"</c:if>>未启用</input>
							</td>
				 </tr>
					<tr height="35px">
						  <td>备注：
							</td>
						  <td colspan="3">
								<textarea name="LIMIT_ADDINFO" cols="60" rows="5"  maxlength="400" >${ETF.LIMIT_ADDINFO}</textarea>
							</td>
				 </tr>
			</table>
	
		</div>
		<div class="formBar">
			<ul>	 
	      <li><div class="buttonActive"><div class="buttonContent"><button type="submit" onclick="return check();" >保存</button></div></div></li>
	 	    <li><div class="button"><div class="buttonContent"><button type="reset">重置</button></div></div></li>
				<li><div class="buttonActive"><div class="buttonContent"><button type="button" class="close" >返回</button></div></div></li>
				<!--
				<li><div class="buttonActive"><div class="buttonContent"><button type="button"  onclick="history.go(-1)" >返回</button></div></div></li>
				-->
			</ul>
		</div>
	</form>	
</div>
 
  